package com.sangmo.fts.user.repo;

import com.sangmo.boot.framework.plugin.dataview.spi.jpa.IJpaDataViewRepo;
import com.sangmo.fts.user.model.Role;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Collection;

@Repository
public interface RoleRepo extends IJpaDataViewRepo<Role> {

    Role findByExRoleId(String exRoleId);

//    @Query("SELECT a FROM Role a WHERE EXISTS (SELECT 1 FROM UserRole b WHERE b.roleId = a.id AND b.userId = :userId)")
//    Collection<Role> findByUserId(@Param("userId")Long userId);

}
